package com.example.demo.service;

import com.example.demo.entity.InstrumentCollection;
import com.example.demo.entity.LikeNoteComment;
import com.example.demo.mapper.LikeNoteCommentMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LikeNoteCommentImpl implements LikeNoteCommentService {

    @Autowired

    private LikeNoteCommentMapper likeNoteCommentMapper;


    //点赞
    @Override
    public boolean insertLikeNoteComment(LikeNoteComment likeNoteComment){
        return likeNoteCommentMapper.insertLikeNoteComment(likeNoteComment) >0;
    }

    //取消点赞
    @Override
    public boolean deleteLikeNoteComment(LikeNoteComment likeNoteComment) {
        return likeNoteCommentMapper.deleteLikeNoteComment(likeNoteComment.getUser_id(), likeNoteComment.getNote_comment_id()) > 0;
    }

    //查询是否已经点过赞
    @Override
    public boolean checkIfLike(Integer user_id, Integer note_comment_id) {
        return likeNoteCommentMapper.checkIfLike(user_id, note_comment_id) > 0;
    }

    //根据笔记id统计点赞数量
   @Override
    public Integer countLike(Integer note_comment_id){
       return likeNoteCommentMapper.countLike(note_comment_id);
   }

}
